;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
;;;
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages lua)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages pkg-config)
  #:use-module ((guixrus packages atf) #:prefix rus:)
  #:use-module ((guixrus contributors) #:prefix contributor:))

(define-public lutok
  ;; The last tag was in 2014, the last commit in 2016.
  (let ((commit "8f8eaefe8b7c76e286b96fcbe2e860af98de29ea")
        (revision "0"))
    (package
     (name "lutok")
     (version (git-version "0.4" revision commit))
     (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/jmmv/lutok")
                    (commit commit)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "08ajd8bb4pzrbak3kq5arxgy82wg43vfdxilyfx1p6pyp6g18jj8"))))
     (build-system gnu-build-system)
     (inputs (list lua-5.2))
     (native-inputs (list rus:atf autoconf automake libtool pkg-config))
     (arguments
      ;; Tests require Kyua, which depends itself on Lutok.
      (list #:tests? #f))
     (home-page "https://github.com/jmmv/lutok")
     (synopsis "Lightweight C++ API for Lua")
     (description
      "Lutok provides a lightweight wrapper around Lua's C interfaces that eases
the interaction between C++ and Lua. These wrappers make intensive use of RAII
to prevent resource leakage, expose C++-friendly data types, report errors by
means of exceptions and ensure that the Lua stack is always left untouched in
the face of errors.")
     (license license:bsd-3)
     (properties `((maintainers . (,contributor:unmatched-paren)))))))
